1290A - Mind Control - CodeForces Solution


brute force data structures implementation *1600

Please click on ads to support us..

C++ Code:

#include <bits/stdc++.h>

// iostream is too mainstream

#include <cstdio>

// bitch please

#include <iostream>

#include <algorithm>

#include <cstdlib>

#include <vector>

#include <set>

#include <map>

#include <queue>

#include <stack>

#include <list>

#include <cmath>

#include <iomanip>

#include <time.h>

#define dibs reserve

#define OVER9000 1234567890

#define ALL_THE(CAKE,LIE) for(auto LIE =CAKE.begin(); LIE != CAKE.end(); LIE++)

#define tisic 47

#define soclose 1e-8

#define chocolate win

// so much chocolate

#define patkan 9

#define ff first

#define ss second

#define abs(x) (((x) < 0)?-(x):(x))

#define uint unsigned int

#define dbl long double

#define pi 3.14159265358979323846

using namespace std;

// mylittledoge



using cat = long long;



#ifdef DONLINE_JUDGE

	// palindromic tree is better than splay tree!

	#define lld I64d

#endif



int main() {

	cin.sync_with_stdio(0);

	cin.tie(0);

	cout << fixed << setprecision(10);

	int T;

	cin >> T;

	while(T--) {

		int N, M, K;

		cin >> N >> M >> K;

		M--;

		K = min(K, M);

		vector<int> A(N);

		for(int i = 0; i < N; i++) cin >> A[i];

		int ans = 0;

		for(int i = 0; i <= K; i++) {

			int cur = OVER9000;

			for(int j = 0; j <= M-K; j++)

				cur = min(cur, max(A[i+j], A[N-1-(M-K-j+K-i)]));

			ans = max(ans, cur);

		}

		cout << ans << "\n";

	}

	return 0;

}



// look at my code

// my code is amazing


Comments

Submit
0 Comments
More Questions

734A - Anton and Danik
1300B - Assigning to Classes
1647A - Madoka and Math Dad
710A - King Moves
1131A - Sea Battle
118A - String Task
236A - Boy or Girl
271A - Beautiful Year
520B - Two Buttons
231A - Team
479C - Exams
1030A - In Search of an Easy Problem
158A - Next Round
71A - Way Too Long Words
160A - Twins
1A - Theatre Square
1614B - Divan and a New Project
791A - Bear and Big Brother
1452A - Robot Program
344A - Magnets
96A - Football
702B - Powers of Two
1036A - Function Height
443A - Anton and Letters
1478B - Nezzar and Lucky Number
228A - Is your horseshoe on the other hoof
122A - Lucky Division
1611C - Polycarp Recovers the Permutation
432A - Choosing Teams
758A - Holiday Of Equality